<template>
    <section>

        <!--工具条-->
        <el-col :span='24' class='toolbar' style='padding-bottom: 0px;'>
            <el-form :inline='true' :model='filters' @submit.native.prevent>
                <el-form-item>
                    <el-input v-model='filters.name' placeholder='名称/Key'></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type='primary' @click='getDtoPage'>查询</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type='primary' @click='handleAdd'>新增</el-button>
                </el-form-item>
                <el-button type='danger' @click='batchRemove' :disabled='this.sels.length===0'>批量删除</el-button>
            </el-form>
        </el-col>

        <!--列表-->
        <el-table :data='users' highlight-current-row v-loading='listLoading' @selection-change='selsChange'
                  style='width: 100%;'
                  sortable='custom' @sort-change='sortKey'>

            <el-table-column type="selection" width="50">
            </el-table-column>
            <el-table-column type="index" width="80">
            </el-table-column>


            <!--<el-table-column prop='Canning_ID' label='' width='' sortable>  </el-table-column>-->
            <!--<el-table-column prop='Canning_TongDaoID' label='通道编号' width='' sortable>  </el-table-column>-->
            <el-table-column prop='Canning_Car' label='车牌号' width='' sortable>  </el-table-column>
            <!--<el-table-column prop='Canning_CarCode' label='车辆卡号' width='' sortable>  </el-table-column>-->
            <el-table-column prop='Canning_Customer' label='客户名称' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Tare' label='皮重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_GrossWeight' label='毛重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_NetWeight' label='净重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Varieties' label='品种' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_BeginTime' label='开始时间' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_EndTime' label='结束时间' width='' sortable>  </el-table-column>
            <!--<el-table-column prop='Canning_Count' label='装载次数' width='' sortable>  </el-table-column>-->
            <el-table-column prop='Canning_Order' label='订单' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_storage' label='仓库' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_OrderCreatetime' label='登记时间' width='' sortable>  </el-table-column>

            <!--<el-table-column prop='Canning_State' label='状态' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_CreateTime' label='创建时间' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_InsertTime' label='插入时间' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Remark' label='备注' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_weightserialcode' label='重量序列号' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_accountcode' label='客户编码' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_accountname' label='客户名称' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_carrycode' label='运输商编码' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_carryname' label='运输商名称' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_procode' label='品种编码' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_proname' label='品种名称' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_trucktype' label='车型' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_truckweight' label='车辆标载' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Orderbstype' label='业务类型' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Orderpreweight' label='请发量' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Ordertareweight' label='皮重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Ordergrossweight' label='毛重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Ordernetweight' label='净重' width='' sortable>  </el-table-column>
            <el-table-column prop='Canning_Orderstatus' label='车辆状态 Y 已装车 N 未装车' width='' sortable>  </el-table-column>-->


            <el-table-column label='操作' width='150'>
                <template scope='scope'>
                    <!--<el-button size='small' @click='handleEdit(scope.$index, scope.row)'> 编辑 </el-button>-->
                    <el-button type='danger' size='small' @click='handleDel(scope.$index, scope.row)'> 删除 </el-button>
                </template>
            </el-table-column>

        </el-table>

        <!-- 工具条 ,分页 -->
        <el-col :span='24' class='toolbar'>

            <el-pagination layout='prev, pager, next' @current-change='handleCurrentChange' :page-size='50'
                           :total='total' style='float:right;'>
            </el-pagination>
        </el-col>

        <!--编辑界面-->
        <el-dialog title='编辑' :visible.sync='editFormVisible' v-model='editFormVisible' :close-on-click-modal='false'>
            <el-form :model='editForm' label-width='80px' :rules='editFormRules' ref='editForm'>

                <el-form-item label='' prop='Canning_ID'>
                    <el-input v-model='editForm.Canning_ID' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车牌号' prop='Canning_Car'>
                    <el-input v-model='editForm.Canning_Car' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车辆卡号' prop='Canning_CarCode'>
                    <el-input v-model='editForm.Canning_CarCode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户名称' prop='Canning_Customer'>
                    <el-input v-model='editForm.Canning_Customer' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='通道编号' prop='Canning_TongDaoID'>
                    <el-input v-model='editForm.Canning_TongDaoID' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='皮重' prop='Canning_Tare'>
                    <el-input v-model='editForm.Canning_Tare' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='毛重' prop='Canning_GrossWeight'>
                    <el-input v-model='editForm.Canning_GrossWeight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='净重' prop='Canning_NetWeight'>
                    <el-input v-model='editForm.Canning_NetWeight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种' prop='Canning_Varieties'>
                    <el-input v-model='editForm.Canning_Varieties' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='开始时间' prop='Canning_BeginTime'>
                    <el-input v-model='editForm.Canning_BeginTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='结束时间' prop='Canning_EndTime'>
                    <el-input v-model='editForm.Canning_EndTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='装载次数' prop='Canning_Count'>
                    <el-input v-model='editForm.Canning_Count' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='状态' prop='Canning_State'>
                    <el-input v-model='editForm.Canning_State' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='创建时间' prop='Canning_CreateTime'>
                    <el-input v-model='editForm.Canning_CreateTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='插入时间' prop='Canning_InsertTime'>
                    <el-input v-model='editForm.Canning_InsertTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='备注' prop='Canning_Remark'>
                    <el-input v-model='editForm.Canning_Remark' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='订单' prop='Canning_Order'>
                    <el-input v-model='editForm.Canning_Order' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='重量序列号' prop='Canning_weightserialcode'>
                    <el-input v-model='editForm.Canning_weightserialcode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户编码' prop='Canning_accountcode'>
                    <el-input v-model='editForm.Canning_accountcode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户名称' prop='Canning_accountname'>
                    <el-input v-model='editForm.Canning_accountname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='运输商编码' prop='Canning_carrycode'>
                    <el-input v-model='editForm.Canning_carrycode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='运输商名称' prop='Canning_carryname'>
                    <el-input v-model='editForm.Canning_carryname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种编码' prop='Canning_procode'>
                    <el-input v-model='editForm.Canning_procode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种名称' prop='Canning_proname'>
                    <el-input v-model='editForm.Canning_proname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车型' prop='Canning_trucktype'>
                    <el-input v-model='editForm.Canning_trucktype' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车辆标载' prop='Canning_truckweight'>
                    <el-input v-model='editForm.Canning_truckweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='仓库' prop='Canning_storage'>
                    <el-input v-model='editForm.Canning_storage' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='登记时间' prop='Canning_OrderCreatetime'>
                    <el-input v-model='editForm.Canning_OrderCreatetime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='业务类型' prop='Canning_Orderbstype'>
                    <el-input v-model='editForm.Canning_Orderbstype' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='请发量' prop='Canning_Orderpreweight'>
                    <el-input v-model='editForm.Canning_Orderpreweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='皮重' prop='Canning_Ordertareweight'>
                    <el-input v-model='editForm.Canning_Ordertareweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='毛重' prop='Canning_Ordergrossweight'>
                    <el-input v-model='editForm.Canning_Ordergrossweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='净重' prop='Canning_Ordernetweight'>
                    <el-input v-model='editForm.Canning_Ordernetweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车辆状态 Y 已装车 N 未装车' prop='Canning_Orderstatus'>
                    <el-input v-model='editForm.Canning_Orderstatus' auto-complete='off'></el-input>
                </el-form-item>


            </el-form>
            <div slot='footer' class='dialog-footer'>
                <el-button @click.native='editFormVisible = false'>取消</el-button>
                <el-button type='primary' @click.native='editSubmit' :loading='editLoading'>提交</el-button>
            </div>
        </el-dialog>

        <!--新增界面-->
        <el-dialog title='新增' :visible.sync='addFormVisible' v-model='addFormVisible' :close-on-click-modal='false'>
            <el-form :model='addForm' label-width='80px' :rules='addFormRules' ref='addForm'>

                <!--<el-form-item label='' prop='Canning_ID'>
                    <el-input v-model='addForm.Canning_ID' auto-complete='off'></el-input>
                </el-form-item>-->

                <el-form-item label='车牌号' prop='Canning_Car'>
                    <el-input v-model='addForm.Canning_Car' auto-complete='off'></el-input>
                </el-form-item>


                <!--<el-form-item label='车辆卡号' prop='Canning_CarCode'>
                    <el-input v-model='addForm.Canning_CarCode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户名称' prop='Canning_Customer'>
                    <el-input v-model='addForm.Canning_Customer' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='通道编号' prop='Canning_TongDaoID'>
                    <el-input v-model='addForm.Canning_TongDaoID' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='皮重' prop='Canning_Tare'>
                    <el-input v-model='addForm.Canning_Tare' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='毛重' prop='Canning_GrossWeight'>
                    <el-input v-model='addForm.Canning_GrossWeight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='净重' prop='Canning_NetWeight'>
                    <el-input v-model='addForm.Canning_NetWeight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种' prop='Canning_Varieties'>
                    <el-input v-model='addForm.Canning_Varieties' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='开始时间' prop='Canning_BeginTime'>
                    <el-input v-model='addForm.Canning_BeginTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='结束时间' prop='Canning_EndTime'>
                    <el-input v-model='addForm.Canning_EndTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='装载次数' prop='Canning_Count'>
                    <el-input v-model='addForm.Canning_Count' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='状态' prop='Canning_State'>
                    <el-input v-model='addForm.Canning_State' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='创建时间' prop='Canning_CreateTime'>
                    <el-input v-model='addForm.Canning_CreateTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='插入时间' prop='Canning_InsertTime'>
                    <el-input v-model='addForm.Canning_InsertTime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='备注' prop='Canning_Remark'>
                    <el-input v-model='addForm.Canning_Remark' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='订单' prop='Canning_Order'>
                    <el-input v-model='addForm.Canning_Order' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='重量序列号' prop='Canning_weightserialcode'>
                    <el-input v-model='addForm.Canning_weightserialcode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户编码' prop='Canning_accountcode'>
                    <el-input v-model='addForm.Canning_accountcode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='客户名称' prop='Canning_accountname'>
                    <el-input v-model='addForm.Canning_accountname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='运输商编码' prop='Canning_carrycode'>
                    <el-input v-model='addForm.Canning_carrycode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='运输商名称' prop='Canning_carryname'>
                    <el-input v-model='addForm.Canning_carryname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种编码' prop='Canning_procode'>
                    <el-input v-model='addForm.Canning_procode' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='品种名称' prop='Canning_proname'>
                    <el-input v-model='addForm.Canning_proname' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车型' prop='Canning_trucktype'>
                    <el-input v-model='addForm.Canning_trucktype' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车辆标载' prop='Canning_truckweight'>
                    <el-input v-model='addForm.Canning_truckweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='仓库' prop='Canning_storage'>
                    <el-input v-model='addForm.Canning_storage' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='登记时间' prop='Canning_OrderCreatetime'>
                    <el-input v-model='addForm.Canning_OrderCreatetime' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='业务类型' prop='Canning_Orderbstype'>
                    <el-input v-model='addForm.Canning_Orderbstype' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='请发量' prop='Canning_Orderpreweight'>
                    <el-input v-model='addForm.Canning_Orderpreweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='皮重' prop='Canning_Ordertareweight'>
                    <el-input v-model='addForm.Canning_Ordertareweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='毛重' prop='Canning_Ordergrossweight'>
                    <el-input v-model='addForm.Canning_Ordergrossweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='净重' prop='Canning_Ordernetweight'>
                    <el-input v-model='addForm.Canning_Ordernetweight' auto-complete='off'></el-input>
                </el-form-item>


                <el-form-item label='车辆状态 Y 已装车 N 未装车' prop='Canning_Orderstatus'>
                    <el-input v-model='addForm.Canning_Orderstatus' auto-complete='off'></el-input>
                </el-form-item>-->



            </el-form>
            <div slot='footer' class='dialog-footer'>
                <el-button @click.native='addFormVisible = false'>取消</el-button>
                <el-button type='primary' @click.native='addSubmit' :loading='addLoading'>提交</el-button>
            </div>
        </el-dialog>


    </section>
</template>
<script>

    
    import util from '../../../../util/date'
    import { testapi, getPage_DTSN_Canning, getByID_DTSN_Canning, edit_DTSN_Canning, add_DTSN_Canning, batchRemove_DTSN_Canning, Remove_DTSN_Canning } from '../../../api/api';


    export default {
        name: "Menu12",
        data() {   // 全局变量
            return {
                filters: { name: '' },
                users: [],
                total: 0,
                page: 1,
                listLoading: false,
                sels: [],//列表选中列
                addDialogFormVisible: false,
                editFormVisible: false,//编辑界面是否显示
                editLoading: false,
                editFormRules: {
                    Canning_ID: [{ required: true, message: '请输入', trigger: 'blur' }],
                    Canning_Car: [{ required: true, message: '请输入车牌号', trigger: 'blur' }],
                    Canning_CarCode: [{ required: true, message: '请输入车辆卡号', trigger: 'blur' }],
                    Canning_Customer: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
                    Canning_TongDaoID: [{ required: true, message: '请输入通道编号', trigger: 'blur' }],
                    Canning_Tare: [{ required: true, message: '请输入皮重', trigger: 'blur' }],
                    Canning_GrossWeight: [{ required: true, message: '请输入毛重', trigger: 'blur' }],
                    Canning_NetWeight: [{ required: true, message: '请输入净重', trigger: 'blur' }],
                    Canning_Varieties: [{ required: true, message: '请输入品种', trigger: 'blur' }],
                    Canning_BeginTime: [{ required: true, message: '请输入开始时间', trigger: 'blur' }],
                    Canning_EndTime: [{ required: true, message: '请输入结束时间', trigger: 'blur' }],
                    Canning_Count: [{ required: true, message: '请输入装载次数', trigger: 'blur' }],
                    Canning_State: [{ required: true, message: '请输入状态', trigger: 'blur' }],
                    Canning_CreateTime: [{ required: true, message: '请输入创建时间', trigger: 'blur' }],
                    Canning_InsertTime: [{ required: true, message: '请输入插入时间', trigger: 'blur' }],
                    Canning_Remark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
                    Canning_Order: [{ required: true, message: '请输入订单', trigger: 'blur' }],
                    Canning_weightserialcode: [{ required: true, message: '请输入重量序列号', trigger: 'blur' }],
                    Canning_accountcode: [{ required: true, message: '请输入客户编码', trigger: 'blur' }],
                    Canning_accountname: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
                    Canning_carrycode: [{ required: true, message: '请输入运输商编码', trigger: 'blur' }],
                    Canning_carryname: [{ required: true, message: '请输入运输商名称', trigger: 'blur' }],
                    Canning_procode: [{ required: true, message: '请输入品种编码', trigger: 'blur' }],
                    Canning_proname: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
                    Canning_trucktype: [{ required: true, message: '请输入车型', trigger: 'blur' }],
                    Canning_truckweight: [{ required: true, message: '请输入车辆标载', trigger: 'blur' }],
                    Canning_storage: [{ required: true, message: '请输入仓库', trigger: 'blur' }],
                    Canning_OrderCreatetime: [{ required: true, message: '请输入登记时间', trigger: 'blur' }],
                    Canning_Orderbstype: [{ required: true, message: '请输入业务类型', trigger: 'blur' }],
                    Canning_Orderpreweight: [{ required: true, message: '请输入请发量', trigger: 'blur' }],
                    Canning_Ordertareweight: [{ required: true, message: '请输入皮重', trigger: 'blur' }],
                    Canning_Ordergrossweight: [{ required: true, message: '请输入毛重', trigger: 'blur' }],
                    Canning_Ordernetweight: [{ required: true, message: '请输入净重', trigger: 'blur' }],
                    Canning_Orderstatus: [{ required: true, message: '请输入车辆状态 Y 已装车 N 未装车', trigger: 'blur' }],
                }
                ,
                //编辑界面数据
                editForm: {
                    Canning_ID: 0,
                    Canning_Car: '',
                    Canning_CarCode: '',
                    Canning_Customer: '',
                    Canning_TongDaoID: 0,
                    Canning_Tare: 0,
                    Canning_GrossWeight: 0,
                    Canning_NetWeight: 0,
                    Canning_Varieties: '',
                    Canning_BeginTime: 0,
                    Canning_EndTime: 0,
                    Canning_Count: 0,
                    Canning_State: 0,
                    Canning_CreateTime: 0,
                    Canning_InsertTime: 0,
                    Canning_Remark: '',
                    Canning_Order: '',
                    Canning_weightserialcode: '',
                    Canning_accountcode: '',
                    Canning_accountname: '',
                    Canning_carrycode: '',
                    Canning_carryname: '',
                    Canning_procode: '',
                    Canning_proname: '',
                    Canning_trucktype: '',
                    Canning_truckweight: '',
                    Canning_storage: '',
                    Canning_OrderCreatetime: 0,
                    Canning_Orderbstype: '',
                    Canning_Orderpreweight: 0,
                    Canning_Ordertareweight: 0,
                    Canning_Ordergrossweight: 0,
                    Canning_Ordernetweight: 0,
                    Canning_Orderstatus: '',
                }
                ,
                addFormVisible: false,//新增界面是否显示
                addLoading: false,
                addFormRules: {
                    Canning_ID: [{ required: true, message: '请输入', trigger: 'blur' }],
                    Canning_Car: [{ required: true, message: '请输入车牌号', trigger: 'blur' }],
                    Canning_CarCode: [{ required: true, message: '请输入车辆卡号', trigger: 'blur' }],
                    Canning_Customer: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
                    Canning_TongDaoID: [{ required: true, message: '请输入通道编号', trigger: 'blur' }],
                    Canning_Tare: [{ required: true, message: '请输入皮重', trigger: 'blur' }],
                    Canning_GrossWeight: [{ required: true, message: '请输入毛重', trigger: 'blur' }],
                    Canning_NetWeight: [{ required: true, message: '请输入净重', trigger: 'blur' }],
                    Canning_Varieties: [{ required: true, message: '请输入品种', trigger: 'blur' }],
                    Canning_BeginTime: [{ required: true, message: '请输入开始时间', trigger: 'blur' }],
                    Canning_EndTime: [{ required: true, message: '请输入结束时间', trigger: 'blur' }],
                    Canning_Count: [{ required: true, message: '请输入装载次数', trigger: 'blur' }],
                    Canning_State: [{ required: true, message: '请输入状态', trigger: 'blur' }],
                    Canning_CreateTime: [{ required: true, message: '请输入创建时间', trigger: 'blur' }],
                    Canning_InsertTime: [{ required: true, message: '请输入插入时间', trigger: 'blur' }],
                    Canning_Remark: [{ required: true, message: '请输入备注', trigger: 'blur' }],
                    Canning_Order: [{ required: true, message: '请输入订单', trigger: 'blur' }],
                    Canning_weightserialcode: [{ required: true, message: '请输入重量序列号', trigger: 'blur' }],
                    Canning_accountcode: [{ required: true, message: '请输入客户编码', trigger: 'blur' }],
                    Canning_accountname: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
                    Canning_carrycode: [{ required: true, message: '请输入运输商编码', trigger: 'blur' }],
                    Canning_carryname: [{ required: true, message: '请输入运输商名称', trigger: 'blur' }],
                    Canning_procode: [{ required: true, message: '请输入品种编码', trigger: 'blur' }],
                    Canning_proname: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
                    Canning_trucktype: [{ required: true, message: '请输入车型', trigger: 'blur' }],
                    Canning_truckweight: [{ required: true, message: '请输入车辆标载', trigger: 'blur' }],
                    Canning_storage: [{ required: true, message: '请输入仓库', trigger: 'blur' }],
                    Canning_OrderCreatetime: [{ required: true, message: '请输入登记时间', trigger: 'blur' }],
                    Canning_Orderbstype: [{ required: true, message: '请输入业务类型', trigger: 'blur' }],
                    Canning_Orderpreweight: [{ required: true, message: '请输入请发量', trigger: 'blur' }],
                    Canning_Ordertareweight: [{ required: true, message: '请输入皮重', trigger: 'blur' }],
                    Canning_Ordergrossweight: [{ required: true, message: '请输入毛重', trigger: 'blur' }],
                    Canning_Ordernetweight: [{ required: true, message: '请输入净重', trigger: 'blur' }],
                    Canning_Orderstatus: [{ required: true, message: '请输入车辆状态 Y 已装车 N 未装车', trigger: 'blur' }],
                }
                ,
                //新增界面数据
                addForm: {
                    Canning_Car: '',
                    Canning_CarCode: '',
                    Canning_Customer: '',
                    Canning_TongDaoID: 0,
                    Canning_Tare: 0,
                    Canning_GrossWeight: 0,
                    Canning_NetWeight: 0,
                    Canning_Varieties: '',
                    Canning_BeginTime: null,
                    Canning_EndTime: null,
                    Canning_Count: 0,
                    Canning_State: 0,
                    Canning_CreateTime: null,
                    Canning_InsertTime: null,
                    Canning_Remark: '',
                    Canning_Order: '',
                    Canning_weightserialcode: '',
                    Canning_accountcode: '',
                    Canning_accountname: '',
                    Canning_carrycode: '',
                    Canning_carryname: '',
                    Canning_procode: '',
                    Canning_proname: '',
                    Canning_trucktype: '',
                    Canning_truckweight: '',
                    Canning_storage: '',
                    Canning_OrderCreatetime: null,
                    Canning_Orderbstype: '',
                    Canning_Orderpreweight: 0,
                    Canning_Ordertareweight: 0,
                    Canning_Ordergrossweight: 0,
                    Canning_Ordernetweight: 0,
                    Canning_Orderstatus: '',
                }

            }
        },
        methods: {    // 全局方法
            //性别显示转换
            //formatSex: function (row, column) {
            //    return row.C_Value == 2 ? '男' : row.C_Value;
            //},
            //formatterCreateTime: function (row, column) {
            //    return (!row.C_CreateTime || row.C_CreateTime == '') ? '' : util.formatDate.format(new Date(row.C_CreateTime), 'yyyy-MM-dd');
            //},
            handleCurrentChange(val) {
                this.page = val;
                this.getDtoPage();
            },
            // 测试
            sortKey(val) {
                console.log(val)
            },


            //获取用户列表
            getDtoPage() {
                let para = {
                    page: this.page,
                    key: this.filters.name
                };
                this.listLoading = true;

                testapi();

                getPage_DTSN_Canning(para).then((res) => {
                    console.log(res);
                    this.total = res.data.response.dataCount;
                    this.users = res.data.response.data;
                    this.listLoading = false;

                });
            },
            //删除
            handleDel: function (index, row) {
                this.$confirm('确认删除该记录吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.listLoading = true;
                    let para = { id: row.Canning_ID };
                    Remove_DTSN_Canning(para).then((res) => {
                        if (util.isEmt.format(res)) {
                            this.listLoading = false;
                            return;
                        }
                        this.listLoading = false;
                        if (res.data.success) {
                            this.$message({
                                message: '删除成功',
                                type: 'success'
                            });
                        } else {
                            this.$message({
                                message: res.data.msg,
                                type: 'error'
                            });
                        }
                        this.getDtoPage();
                    });
                }).catch((c) => {
                    console.log(c);
                });
            },
            //显示编辑界面
            handleEdit: function (index, row) {
                this.editFormVisible = true;

                let para_getGetByID = { id: row.Canning_ID };

                getByID_DTSN_Canning(para_getGetByID).then((getDto) => {

                    this.editForm = Object.assign({}, getDto.data.response);
                });
            },
            //显示新增界面
            handleAdd() {
                this.addFormVisible = true;
                this.addForm = {
                    Canning_Car: '',
                    Canning_CarCode: '',
                    Canning_Customer: '',
                    Canning_TongDaoID: 0,
                    Canning_Tare: 0,
                    Canning_GrossWeight: 0,
                    Canning_NetWeight: 0,
                    Canning_Varieties: '',
                    Canning_BeginTime: null,
                    Canning_EndTime: null,
                    Canning_Count: 0,
                    Canning_State: 0,
                    Canning_CreateTime: null,
                    Canning_InsertTime: null,
                    Canning_Remark: '',
                    Canning_Order: '',
                    Canning_weightserialcode: '',
                    Canning_accountcode: '',
                    Canning_accountname: '',
                    Canning_carrycode: '',
                    Canning_carryname: '',
                    Canning_procode: '',
                    Canning_proname: '',
                    Canning_trucktype: '',
                    Canning_truckweight: '',
                    Canning_storage: '',
                    Canning_OrderCreatetime: null,
                    Canning_Orderbstype: '',
                    Canning_Orderpreweight: 0,
                    Canning_Ordertareweight: 0,
                    Canning_Ordergrossweight: 0,
                    Canning_Ordernetweight: 0,
                    Canning_Orderstatus: '',
                }
                    ;
            },
            //编辑
            editSubmit: function () {
                this.$refs.editForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                        }).then(() => {
                            this.editLoading = true;
                            //NProgress.start();
                            let para = Object.assign({}, this.editForm);
                            console.log(para);
                            edit_DTSN_Canning(para).then((res) => {

                                if (util.isEmt.format(res)) {
                                    this.editLoading = false;
                                    return;
                                }
                                if (res.data.success) {
                                    this.editLoading = false;

                                    this.$message({
                                        message: res.data.msg,
                                        type: 'success'
                                    });
                                    this.$refs['editForm'].resetFields();
                                    this.editFormVisible = false;
                                    this.getDtoPage();
                                } else {
                                    this.$message({
                                        message: res.data.msg,
                                        type: 'error'
                                    });
                                }
                            });
                        });
                    }
                });
            },
            //新增
            addSubmit: function () {
                this.$refs.addForm.validate((valid) => {
                    if (valid) {
                        this.$confirm('确认提交吗？', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                        }).then(() => {
                            this.addLoading = true;
                            let para = Object.assign({}, this.addForm);

                            add_DTSN_Canning(para).then((res) => {

                                if (util.isEmt.format(res)) {
                                    this.addLoading = false;
                                    return;
                                }

                                if (res.data.success) {
                                    this.addLoading = false;
                                    this.$message({
                                        message: res.data.msg,
                                        type: 'success'
                                    });
                                    this.$refs['addForm'].resetFields();
                                    this.addFormVisible = false;
                                    this.getDtoPage();
                                }
                                else {
                                    this.$message({
                                        message: res.data.msg,
                                        type: 'error'
                                    });
                                }
                            });
                        });
                    }
                });
            },
            selsChange: function (sels) {
                this.sels = sels;
            },
            //批量删除
            batchRemove: function () {

                var ids = this.sels.map(item => item.Canning_ID).toString();
                this.$confirm('确认删除选中记录吗？', '提示', {
                    type: 'warning',
                    confirmButtonText: '确定',
                    cancelButtonText: '取消'
                }).then(() => {
                    this.listLoading = true;
                    let para = { ids: ids };

                    batchRemove_DTSN_Canning(para).then((res) => {
                        this.listLoading = false;

                        if (res.data.success) {
                            this.$message({
                                message: '删除成功',
                                type: 'success'
                            });
                        } else {
                            this.$message({
                                message: res.data.msg,
                                type: 'error'
                            });
                        }
                        this.getDtoPage();
                        console.log(res)
                    });
                }).catch(() => {

                });
            }
        },
        mounted() {
            this.getDtoPage();
        }

    }



</script>
<style scoped>
</style>